package com.lifeng.finance.demo.service;

import com.lifeng.finance.demo.entity.Project;
import com.lifeng.finance.demo.mapper.ProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ProjectService implements ProjectMapper {

    @Autowired
    private ProjectMapper projectMapper;

    public List<Project> findAll() {
        return projectMapper.findAll();
    }

//    @Autowired
    public Project findOneById(int id) {
        return projectMapper.findOneById(id);
    }

    public List<Project> findSomeByName(String name) {
        name = "%" + name + "%";
        return projectMapper.findSomeByName(name);
    }

    @Override
    public List<Project> findSomeByCustomerId(int customerId) {
        return projectMapper.findSomeByCustomerId(customerId);
    }


    public void add(Project project) {

        projectMapper.add(project);

    }

    @Override
    public void update(Project project) {
        projectMapper.update(project);
    }

}
